package com.spring.lesson001.demo12;

import org.junit.Test;

/**
 * @author vhans
 */
public class ProxyTest {
    @Test
    public void test() {
        IService serviceA = new ServiceA();
        IService serviceB = new ServiceB();

        serviceA.m1();
        serviceA.m2();
        serviceA.m3();

        serviceB.m1();
        serviceB.m2();
        serviceB.m3();
    }

    @Test
    public void serviceProxy() {
        IService serviceA = new ServiceTimeProxy(new ServiceA());
        IService serviceB = new ServiceTimeProxy(new ServiceB());

        serviceA.m1();
        serviceA.m2();
        serviceA.m3();

        serviceB.m1();
        serviceB.m2();
        serviceB.m3();
    }
}
